<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
  <title>all_games (Team)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
  <pre><span class="ruby-comment cmt"># File lib/team.rb, line 92</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">all_games</span>(<span class="ruby-identifier">year</span>)
    <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@games</span>
      <span class="ruby-identifier">puts</span> <span class="ruby-value str">'Finding all games for team...'</span>
      <span class="ruby-identifier">results</span> = []
      (<span class="ruby-constant">START_MONTH</span><span class="ruby-operator">..</span><span class="ruby-constant">END_MONTH</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">month</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;Month: &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">month</span>.<span class="ruby-identifier">to_s</span>
        <span class="ruby-identifier">month_s</span> = <span class="ruby-constant">GamedayUtil</span>.<span class="ruby-identifier">convert_digit_to_string</span>(<span class="ruby-identifier">month</span>)
        (<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">31</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">date</span><span class="ruby-operator">|</span>
          <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">GamedayUtil</span>.<span class="ruby-identifier">is_date_valid</span>(<span class="ruby-identifier">month</span>, <span class="ruby-identifier">date</span>)
            <span class="ruby-keyword kw">next</span>
          <span class="ruby-keyword kw">end</span>
          <span class="ruby-identifier">date_s</span> = <span class="ruby-constant">GamedayUtil</span>.<span class="ruby-identifier">convert_digit_to_string</span>(<span class="ruby-identifier">date</span>)
          <span class="ruby-identifier">games</span> = <span class="ruby-identifier">games_for_date</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month_s</span>, <span class="ruby-identifier">date_s</span>)
          <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">games</span>
            <span class="ruby-comment cmt"># make sure game was not postponed</span>
            <span class="ruby-identifier">good_games</span> = <span class="ruby-identifier">games</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span> <span class="ruby-identifier">g</span>.<span class="ruby-identifier">get_boxscore</span>.<span class="ruby-identifier">status_ind</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">'P'</span> }
            <span class="ruby-identifier">good_games</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">game</span><span class="ruby-operator">|</span>
              <span class="ruby-identifier">results</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">game</span>
            <span class="ruby-keyword kw">end</span>
          <span class="ruby-keyword kw">end</span>
        <span class="ruby-keyword kw">end</span>
      <span class="ruby-keyword kw">end</span>
      <span class="ruby-ivar">@games</span> = <span class="ruby-identifier">results</span>
    <span class="ruby-keyword kw">end</span>
    <span class="ruby-ivar">@games</span>
  <span class="ruby-keyword kw">end</span></pre>
</body>
</html>